package com.tobeface.wechat.message.payload;

import com.google.common.collect.Maps;
import com.tobeface.wechat.message.WeChatMessageBuilder;
import com.tobeface.wechat.message.WeChatMessagePayloads;
import com.tobeface.wechat.message.WeChatMessageTypes;

import java.util.Map;

/**
 * @author loudyn
 */
public class OutVideoMessagePayloadBuilder extends AbstractMessagePayloadBuilder {

    private String mediaId;
    private String title;
    private String descr;

    /**
     * @param parent
     */
    public OutVideoMessagePayloadBuilder(WeChatMessageBuilder parent) {
        super(parent);
    }

    public OutVideoMessagePayloadBuilder mediaId(String mediaId) {
        this.mediaId = mediaId;
        return this;
    }

    public OutVideoMessagePayloadBuilder title(String title) {
        this.title = title;
        return this;
    }

    public OutVideoMessagePayloadBuilder descr(String descr) {
        this.descr = descr;
        return this;
    }

    @Override
    protected void configPayloads(Map<String, Object> payloads) {
        Map<String, String> payload = Maps.newHashMap();
        payload.put(WeChatMessagePayloads.MEDIAID_PAYLOAD, mediaId);
        payload.put(WeChatMessagePayloads.TITLE_PAYLOAD, title);
        payload.put(WeChatMessagePayloads.DESCR_PAYLOAD, descr);
        payloads.put("Video", payload);
        payloads.put(WeChatMessagePayloads.MSGTYPE_PAYLOAD, WeChatMessageTypes.VIDEO);
    }
}
